{% extends 'TopxiaWebBundle:Settings:layout.html.twig' %}
{% block title %}{{'支付密码'|trans}} - {{'安全设置'|trans}} - {{ parent() }}{% endblock %}
{% set script_controller = 'settings/pay_password' %}
{% set side_nav = 'security' %}

{% block main %}
 {% embed "TopxiaWebBundle:Bootstrap:panel.html.twig" with {class:'panel-col'} %}
    {% block heading %}
       {{'安全设置'|trans}}
    {% endblock %}
    {% block body %}

      <ul class="breadcrumb">
        <li><a href="{{ path('settings_security') }}">{{'安全设置'|trans}}</a></li>
        <li class="active">{{'设置支付密码'|trans}}</li>
      </ul>

      {% if not app.user.password %}
        <div class="alert alert-warning">
          <p>{{'当前帐号从第三方帐号直接登录时创建，尚未设置登录密码。'|trans}}</p>
          <p>{{'为了帐号的安全，请通过邮箱找回密码的方式，重设登录密码！'|trans}}</p>
          <p><a href="{{ path('password_reset') }}" class="btn btn-primary">{{'现在就去重设登录密码！'|trans}}</a></p>
        </div>
      {% endif %}

      <form id="settings-pay-password-form" class="form-horizontal" method="post" {% if not app.user.password %} style="display:none;"{% endif %}>

        {{ web_macro.flash_messages() }}

        <div class="form-group">
          <div class="col-md-2 control-label">{{ form_label(form.currentUserLoginPassword, '用户登录密码'|trans) }}</div>
          <div class="controls col-md-8 controls">
            {{ form_widget(form.currentUserLoginPassword, {attr:{class:'form-control'}}) }}
          </div>
        </div>

        <div class="form-group">
          <div class="col-md-2 control-label">{{ form_label(form.newPayPassword, '新支付密码'|trans) }}</div>
          <div class="controls col-md-8 controls">
            {{ form_widget(form.newPayPassword, {attr:{class:'form-control'}}) }}
          </div>
        </div>

        <div class="form-group">
          <div class="col-md-2 control-label">{{ form_label(form.confirmPayPassword, '确认支付密码'|trans) }}</div>
          <div class="controls col-md-8 controls">
            {{ form_widget(form.confirmPayPassword, {attr:{class:'form-control'}}) }}
          </div>
        </div>

        <div class="form-group">
          <div class="col-md-2 control-label"></div>
          <div class="controls col-md-8 controls">
            {{ form_rest(form) }}
            <button id="password-save-btn" data-submiting-text="{{'正在保存'|trans}}" type="submit" class="btn btn-primary">{{'提交'|trans}}</button>
          </div>
        </div>

        <input type="hidden" name="_csrf_token" value="{{ csrf_token('site') }}">

      </form>


    {% endblock %}
  {% endembed %}
{% endblock %}